package by.bsu.scs.util.manager;

/**
 * @author Alexey Hursevich
 * @version 1.0
 * 
 * Responsible for localization in classes.
 */
public class LocalizationManager {
        
        private String class_prefix;
        private PropertyManager propManager;
        
        /**
         * Initializes class_prefix by the following rule:
         * Any class which uses LocalizationManager should send its class name,
         * for example <code>new LocalizationManager(SomeClass.class.getName())</code>
         * 
         * @param class_prefix
         */
        public LocalizationManager(String class_prefix) {
                this.class_prefix = class_prefix.toLowerCase();
                propManager = PropertyManager.getInstance();
        }
        
        /**
         * Gets value from properties file by key.
         * Keys are stored in the following format:
         * 'package.name.classname_key' .
         *
         * @param key
         * @return value found by the given key
         */
        public String getValue(String key) {
                return propManager.getProperty(class_prefix + "_" + key);
        }
}
